import {
  AveFuncClicksComparisonParams,
  DailyFuncClickCompareDto,
  DailyFuncClicksComparisonParams,
  FuncClicksAverageDto,
  FuncClicksSummaryDto,
  FuncionClicksAverageParams,
  FunctionClicksSummaryParams,
  FunctionCompareDto,
  FunctionNamesParams,
} from './model/functionAnalysisModel';
import { operationHttp } from '/@/utils/http/axios';

enum Api {
  GET_FUNCTION_CLICKS_SUMMARY = '/v1/functionUsage/getTotalClickNums',
  GET_FUNCTION_CLICKS_AVERAGE = '/v1/functionUsage/getAverageClickNums',
  GET_AVE_FUNCTION_CLICKS_COMPARISON = '/v1/functionUsage/getAverageNumsComparison',
  GET_DAILY_FUNCTION_CLICKS_COMPARISON = '/v1/functionUsage/getDailyNumsComparison',
  GET_FUNCTION_NAMES = '/v1/functionUsage/getFunctionNames',
}

export const getFunctionClicksSummary = (params: FunctionClicksSummaryParams) => {
  return operationHttp.get<FuncClicksSummaryDto[]>({ url: Api.GET_FUNCTION_CLICKS_SUMMARY, params });
};

export const getFunctionClicksAverage = (params: FuncionClicksAverageParams) => {
  return operationHttp.get<FuncClicksAverageDto[]>({ url: Api.GET_FUNCTION_CLICKS_AVERAGE, params });
};

export const getAveFunctionClicksComp = (params: AveFuncClicksComparisonParams) => {
  return operationHttp.get<FunctionCompareDto[]>({ url: Api.GET_AVE_FUNCTION_CLICKS_COMPARISON, params });
};

export const getDailyFunctionClicksComp = (params: DailyFuncClicksComparisonParams) => {
  return operationHttp.get<DailyFuncClickCompareDto[]>({ url: Api.GET_DAILY_FUNCTION_CLICKS_COMPARISON, params });
};

export const getFunctionNames = (params: FunctionNamesParams) => {
  return operationHttp.get<string[]>({ url: Api.GET_FUNCTION_NAMES, params });
};
